package com.um.springboot.starter.utils;

import cn.hutool.extra.spring.SpringUtil;
import com.um.springboot.starter.properties.ImplProperties;
import com.um.springboot.starter.service.SmsService;
import lombok.experimental.UtilityClass;

/**
 * @author 甘天伟
 * @since 2024/5/7
 * 版权所有 广州优匠科技有限公司
 */
@UtilityClass
public class ImplUtil {

    /**
     * 获取SmsService
     *
     * @return
     */
    public SmsService getSmsService() {
        ImplProperties implProperties = SpringUtil.getBean(ImplProperties.class);
        return getSmsService(implProperties.getSmsService());
    }

    /**
     * 获取SmsService特定实现：
     * alibabaCloudSmsServiceImpl
     * aliyunSmsServiceImpl
     * tencentSmsServiceImpl
     * thaiBulkSmsServiceImpl
     * ytxSmsServiceImpl
     *
     * @param impl
     * @return
     */
    public SmsService getSmsService(String impl) {
        return SpringUtil.getBean(impl);
    }
}
